package com.software.graduationproject.modules.sys.entity;

import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.v2coding.validate.CreateGroup;
import com.v2coding.validate.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.v2coding.mybatis.model.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;
import java.math.BigDecimal;

/**
 * SysRole : 角色
 * ---------------------------------------------------------------------------------------------------------------------
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("sys_role")
@ApiModel(value = "SysRole", description = "角色")
public class SysRole extends BaseModel<SysRole> {

    @TableField(value ="name")
    @ExcelProperty(value = "角色名称")
    @ApiModelProperty(value = "角色名称")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "角色名称不能为空")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "角色名称长度不能超过255")
    private String name;

    @TableField(value ="code")
    @ExcelProperty(value = "角色编码")
    @ApiModelProperty(value = "角色编码")
    @NotEmpty(groups = {CreateGroup.class, UpdateGroup.class}, message = "角色编码不能为空")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "角色编码长度不能超过255")
    private String code;

    @TableField(value ="descs")
    @ExcelProperty(value = "角色描述")
    @ApiModelProperty(value = "角色描述")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "角色描述长度不能超过255")
    private String descs;

    @TableField(value ="ds_type")
    @ExcelProperty(value = "数据权限类型")
    @ApiModelProperty(value = "数据权限类型")
    private Integer dsType;

    @TableField(value ="ds_scope")
    @ExcelProperty(value = "数据权限范围")
    @ApiModelProperty(value = "数据权限范围")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "数据权限范围长度不能超过255")
    private String dsScope;

    @TableField(value ="type")
    @ExcelProperty(value = "角色类型，对应枚举SysUserType")
    @ApiModelProperty(value = "角色类型，对应枚举SysUserType")
    private Integer type;

    @TableField(value ="own_id")
    @ExcelProperty(value = "拥有者")
    @ApiModelProperty(value = "拥有者")
    private Long ownId;

    @TableField(value ="tenant_id")
    @ExcelProperty(value = "所属租户")
    @ApiModelProperty(value = "所属租户")
    private Long tenantId;

}
